package cn.riverluoo.normative;

import java.io.File;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.xml.sax.SAXException;

import cn.riverluoo.console.ConsoleTextArea;

public class Normative {

	public void showNormative(String newname) {

		ConsoleTextArea ct=new ConsoleTextArea();
		ct.showConsole();

		// 用DocumentBuilderFactory的newInstance()从xml获得生成DOM对象树的解析器
		DocumentBuilderFactory docbf = DocumentBuilderFactory.newInstance();
		try {

			// 利用解析器的newDocumentBuilder()获得示例
			DocumentBuilder docb = docbf.newDocumentBuilder();
			// 用DocumentBuilder的parse()解析xml文件获得Doucment对象下面就可以利用它获得xml文件的内容了
			Document doc = docb.parse(new File(newname));
			System.out.println("文件规范性校验通过!!!");

		}
		catch (ParserConfigurationException e) {
			e.printStackTrace();
		} catch (SAXException e) {
			System.out.println("文件规范性校验未通过,请检查错误提示信息!!!");
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
